package org.reenscape.packet;
import org.reenscape.model.*;
import org.reenscape.skill.*;
public class PacketObject {


		/**
		* Clicking an object normally.
		*/
			public void FirstClick(PacketParser p3){
			    int X = p3.inStream.readSignedWordBigEndianA();
				int ID = p3.inStream.readUnsignedWord();
				int Y = p3.inStream.readUnsignedWordA();
				if(p3.playerRights == 3) p3.sendMessage("O-C1 - "+ID+","+X+","+Y);
				p3.RotateToPoint(X, Y);
				
				if (ID == 1531 || ID == 1537 || ID == 1530 || ID == 1536) {
					p3.doors = p3.GetObject(X, Y, ID);
					p3.skillX = X;
					p3.skillY = Y;
				}

				//Runecrafting
				if(ID == 2478) Skill.runecrafting.Craft(5, 556, "Air", 1, p3);  // AIR ALTAR
				if(ID == 2479) Skill.runecrafting.Craft(5, 558, "Mind", 2, p3); // MIND ALTAR
				if(ID == 2480) Skill.runecrafting.Craft(6, 555, "Water", 5, p3); // WATER ALTAR
				if(ID == 2481) Skill.runecrafting.Craft(6, 557, "Earth", 9, p3); // EARTH ALTAR
				if(ID == 2482) Skill.runecrafting.Craft(7, 554, "Fire", 14, p3); // FIRE ALTAR
				if(ID == 2483) Skill.runecrafting.Craft(8, 559, "Body", 20, p3); // BODY ALTAR
				if(ID == 2484) Skill.runecrafting.Craft(9, 564, "Cosmic", 27, p3); // COSMIC ALTAR
				if(ID == 2485) Skill.runecrafting.Craft(11, 563, "Law", 54, p3); // LAW ALTAR
				if(ID == 2486) Skill.runecrafting.Craft(10, 561, "Nature", 44, p3); // NATURE ALTAR
				
				//Handle the stairs
				//Handle all the rest (Member gates, all the odd stuff, including but not limited to: Prayer Altars, Crafting objects etc.)
			}
			
		/**
		* Right clicking an object and selecting the second option.
		*/
			public void SecondClick(PacketParser p3){
				int ID = p3.inStream.readUnsignedWordBigEndianA();
				int Y = p3.inStream.readSignedWordBigEndian();
				int X = p3.inStream.readUnsignedWordA();
				if(p3.playerRights == 3) p3.sendMessage("O-C2 - "+ID+","+X+","+Y);
				p3.RotateToPoint(X, Y);
				
				if((ID == 2213) ||(ID == 2214) ||(ID == 3045) ||(ID == 5276) ||(ID == 6084) &&(p3.distanceToPoint(X, Y) <= 2)) {
					p3.skillX = X;
					p3.skillY = Y;
					p3.WanneBank = 1;
				}				
				
				//Handle all the ladders
				//Handle anything else like bank windows
			}
		
		/**
		* Right clicking an object and selecting the third option. This does not commonly occur.
		*/
			public void ThirdClick(PacketParser p3){
				int X = p3.inStream.readSignedWordBigEndian();
				int Y = p3.inStream.readUnsignedWord();
				int ID = p3.inStream.readUnsignedWordBigEndianA();
				if(p3.playerRights == 3) p3.sendMessage("O-C3 - "+ID+","+X+","+Y);
				p3.RotateToPoint(X, Y);
				
				//Handle all of the third click objects (Very uncommon).
			}
}